#ifndef _STORAGE_
#define _STORAGE_

#include "Schedule.h"
#include "FileManager.h"
#include <vector>

using namespace std;

const int NUM_OF_PARAMETER = 6;
//6 parameters:day, start/end time, name, place, priority
const string SPILT_PARAMETER = "!@#!";
//special string constant to separate 2 parameters when 
//convert a schedule to a text-format

class Storage{
private:
	fileManager* myfile;

public:
	//Storage(string filename);
	~Storage();
	Storage(){}
	void init_filemanager(string FileName);
	Schedule* schedule_at_index(int index); 
	//return -1 if cannot find the schedule in the file
	//this function check the exactly correct Schedule!
	//different in priority can also make it 
	int find_schedule_index(Schedule* schedule);

	void add_schedule(Schedule* schedule);
	void remove_schedule(int index);

	//should consider to change these 2 methods to static
	//and also move them to Schedule class!
	string schedule_encoder(Schedule* schedule);
	Schedule* schedule_decoder(string textSchedule);

	vector<Schedule*> search_schedule(string keyword,vector<int> &index,Schedule::DATATYPE type);
	vector<Schedule*> get_all_schedule(vector<int> &index);
};

#endif